package com.hejia.alauda.service;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.hejia.alauda.entity.DuibaOrder;
import com.hejia.alauda.persistence.mybatis.DuibaOrderMapper;
import com.hejia.alauda.utils.Pager;

@Service
public class DuibaOrderServiceImpl implements DuibaOrderService {

	@Resource
	private DuibaOrderMapper duibaOrderMapper;
	
	@Override
	public Pager<DuibaOrder> findDuibaOrders(Integer status, String keyword, Pager<DuibaOrder> pager) {
		
		if(status == null && StringUtils.isEmpty(keyword)){
			return pager;
		}
		
		pager.setList(duibaOrderMapper.selectDuibaOrders(status, keyword, pager.getStartNumber(), pager.getPageSize()));
		pager.setTotalCount(duibaOrderMapper.countDuibaOrders(status, keyword));
		
		return pager;
	}

}
